package newTech;

import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

import com.google.common.collect.ArrayTable;
import com.google.common.collect.Lists;
import com.google.common.collect.Table;

import javolution.util.FastTable;
import learn.sss;

public class Common {
	private static FastTable<String> fastTable = new FastTable<>();

	public static void main(String[] args) {
		fastTable.add("hello");
		fastTable.add("world");
		for (int i = 0; i < 50; i++)
			fastTable.add("" + i);
		// Iterator<String> iterator = fastTable.iterator();
		// while (iterator.hasNext()) {
		// System.out.println(iterator.next());
		// }
		fastTable.forEach(sss -> System.out.println(sss));
		List<String> list = fastTable.stream().map(ss -> "this is " + ss).collect(Collectors.toList());
		list.forEach(ss -> System.out.println(ss));
		fastTable.forEach(sss -> System.out.println(sss));

		List<Integer> rowsTable = Lists.newArrayList(1, 2,3);
		List<String> columnsTable = Lists.newArrayList("First Name", "Last Name", "Age");
		Table<Integer, String, Object> table = ArrayTable.create(rowsTable, columnsTable);
		table.put(1, columnsTable.get(0), "zhang");
		table.put(1, columnsTable.get(1), "xionan");
		table.put(1, columnsTable.get(2), 24);
		table.put(2, columnsTable.get(0), "feng");
		table.put(2, columnsTable.get(1), "wei");
		table.put(2, columnsTable.get(2), 26);
		System.out.println(table);
		System.out.println(table.row(1));
		System.out.println(table.row(3));
		System.out.println(table.get(2, columnsTable.get(2)));
	}
}
